package com.kelaite.procurement.entity;

// Generated 2016-3-6 15:13:23 by Hibernate Tools 3.4.0.CR1

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.validator.constraints.NotBlank;

/**
 * TUser generated by hbm2java
 */
@Entity(name = "t_user")
public class TUser extends TBaseEntity {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id")
	private Long id;
	@Column(name = "real_name", length=20)
	private String realName;
	
	@ManyToOne(cascade=CascadeType.REFRESH,optional=false)
	@JoinColumn(name = "company_id")
	private TCompany tCompany;
	
	@Column(name = "username", length=20)
	private String username;
	@Column(name = "password")
	private String password;
	@Column(name = "access_token", length=512)
	private String accessToken;
	@Column(name = "language", length=4)
	private String language;
	@Column(name = "phone", length=20)
	private String phone;
	@Column(name = "mobile_phone", length=20)
	private String mobilePhone;
	@Column(name = "wechat", length=20)
	private String wechat;
	
	@Column(name = "email", length=30)
	private String email;
	
	@Column(name = "type")
	private short type;
	@Column(name = "role_ids")
	private String roleIds;
	@Column(name = "is_delete")
	private short isDelete;  //0表示正常，1表示删除状态
	@Column(name = "gmt_create_time")
	private Date gmtCreateTime;
	@Column(name = "gmt_update_time")
	private Date gmtUpdateTime;
	@Column(name = "created_by")
	private String createdBy;
	@Column(name = "updated_by")
	private String updatedBy;
	@Column(name = "is_company_admin", length=1)
	private Integer isCompanyAdmin;  //是否管理员,第一次进来的用户设置为1，其它用户设置为0

	public TUser() {
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@NotBlank(message="用户昵称不能为空！")
	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public TCompany gettCompany() {
		return tCompany;
	}

	public void settCompany(TCompany tCompany) {
		this.tCompany = tCompany;
	}
	
	@NotBlank(message="用户名不能为空！")
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@NotBlank(message="用户密码不能为空！")
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@NotBlank(message="用户手机号或邮箱不能为空！")
	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public String getWechat() {
		return wechat;
	}

	public void setWechat(String wechat) {
		this.wechat = wechat;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public short getType() {
		return type;
	}

	public void setType(short type) {
		this.type = type;
	}

	public String getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(String roleIds) {
		this.roleIds = roleIds;
	}

	public short getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(short isDelete) {
		this.isDelete = isDelete;
	}

	public Date getGmtCreateTime() {
		return gmtCreateTime;
	}

	public void setGmtCreateTime(Date gmtCreateTime) {
		this.gmtCreateTime = gmtCreateTime;
	}

	public Date getGmtUpdateTime() {
		return gmtUpdateTime;
	}

	public void setGmtUpdateTime(Date gmtUpdateTime) {
		this.gmtUpdateTime = gmtUpdateTime;
	}

	public String getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public String getUpdatedBy() {
		return updatedBy;
	}

	public void setUpdatedBy(String updatedBy) {
		this.updatedBy = updatedBy;
	}

	public Integer getIsCompanyAdmin() {
		return isCompanyAdmin;
	}

	public void setIsCompanyAdmin(Integer isCompanyAdmin) {
		this.isCompanyAdmin = isCompanyAdmin;
	}
	
}
